-
Notifications
You must be signed in to change notification settings - Fork 60
Conversation
…ns. -Adapt unit tests
…uired to keep the voting list update
…ccordingly. - Adapt unit tests
…- Update unit tests
4c66e04
to
56f8bb6
Compare
onEnter={this.loadMore.bind(this)}></Waypoint> | ||
scrollableAncestor={window} | ||
key={this.props.delegates.length} | ||
onEnter={this.loadMore.bind(this)}></Waypoint> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadMore
function doesn't work when page scroller rich end of the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the redux part (actions, reducer). It's even cleaner and more concise than I thought I would be.
Though there is a bug if I do two votes in a row before the first one is processed. The state of votes is not updated correctly, just try it. Note that doing two votes in a row is very likely with the Launch protocol.
src/utils/api/delegate.js
Outdated
@@ -27,7 +27,7 @@ export const voteAutocomplete = (activePeer, username, votedList) => { | |||
listDelegates(activePeer, options) | |||
.then((response) => { | |||
resolve(response.delegates.filter(delegate => | |||
votedList.filter(item => item.username === delegate.username).length === 0, | |||
Object.keys(votedList).filter(item => item === delegate.username).length === 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename votedList
since it is not a list anymore.
src/utils/api/delegate.js
Outdated
resolve( | ||
Object.keys(votedList) | ||
.filter(delegate => delegate.indexOf(username) !== -1) | ||
.map(element => ({ username: element, publicKey: votedList[element].publicKey }))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename votedList
since it is not a list anymore.
@@ -70,15 +70,19 @@ describe('Utils: Delegate', () => { | |||
|
|||
describe('unvoteAutocomplete', () => { | |||
it('should return a promise', () => { | |||
const votedList = ['genesis_1', 'genesis_2', 'genesis_3']; | |||
const voteList = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename voteList
since it is not a list anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job.
Replaces the lists of votes and unvotes with a dictionary including all votes together. This helps eliminate unnecessary iteration over delegates and vote lists to maintain vote status. also, stores the list of delegates and votes in redux store to isolate the voting component from votingDialog component.
to do so, this PR:
votesFetched
,delegatesFetched
,voteToggled
removedFromVoteList
andaddedToVoteList
Closes #723